function checkElementArea(elmArea,callback){
	$(document).mousedown(function(e) {
		$(e.target);
		checkInElement($(e.target),elmArea,callback);
	});
}
function checkInElement(dom,elmArea,callback){
	if($(elmArea).children().find('input').size()==0){return;}
	if($("[name=confirm_save]").size() != 0){ return;}
		if(dom.parents(elmArea).size()==0){
			if($('[class=pageheader]:visible').size()==1)return;
			checkSaveDialog(callback);
		}
}

function checkSaveDialog(callback){
	var content = '<div name="confirm_save">Do you what to save ?</div>';
	var buttons = [
		{ title:"Save" , callback: function(thisdialog,args){
			callback();
			thisdialog.dialog("close");
		}},
	    { title:"Cancel" , callback: function(thisdialog,args){
	    	thisdialog.dialog("close");
	    }}
	];
	customDialog("Save",content,{ width:200},buttons,null);
	
}